
<include file="Public/head"/><body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="space-4"></div>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-3" style='width:300px'>
                                    <div>

                                        <td><img style="width: 188px;height: 250px" src="{:C('FILE_HOST_PATH')}{$novel['img']}"/></td>

                                    </div>

                                    <img style="max-width:100%">
                                    <h4></h4>
                                    <div style="line-height: 1.7em;margin-top:10px;" class="text-muted">
                                        作者: {$novel["writer"]} <br>
                                        字数: {$novel["word_count"]}<br>
                                    </div>
                                    <div class="text-muted" style="margin-top:10px;line-height: 1.7em;">
                                        {$novel["description"]}
                                    </div>
                                </div>
                                <div class="col-sm-9">
                                    <form id="form" method="post" action="{:U('del')}">
                                        <table class="table table-striped table-bordered">
                                            <thead>
                                            <tr>
                                                <th class="center">
                                                </th>
                                                <th>小说章节</th>
                                                <th class="col-xs-6">章节名称</th>
                                                <th>所属小说</th>
                                                <th>添加时间</th>
                                                <if condition="($list neq '') and ($ismeiti eq 1) and (($p eq '') or ($p eq 1))"><th>操作</th></if>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <input type="hidden" class="chapter_first" value="">
                                            <input type="hidden" class="chapter_last" value="{$chapter_last}">
                                            <volist name="list" id="val">
                                                <tr>
                                                    <td class="center">{$val.order_set}
                                                        <input class="aids" type="hidden" name="id[]" value="{$val['id']}">
                                                        <input class="aids" type="hidden" name="novel_id" value="{$val['novel_id']}">
                                                        <input class="uid" type="hidden" name="uid" value="{$uid}">
                                                        <input type="hidden" class="zj_id" name="zj_id" value="">
                                                        <input type="hidden" class="chapter" name="chapter" value="{$val['chapter']}">
                                                    </td>
                                                    <td>{$val['chapter']}</td>
                                                    <td><a data-toggle="modal" class="content_zj" id="{$val['order_set']}" novel-id="{$val['novel_id']}" data-target="#content">{$val['title']}</a><if condition="$val['order_set'] lt 21"> &nbsp;&nbsp;<span style="color: green">免费</span><else/>&nbsp;&nbsp;<span style="color:hotpink"><i class="fa fa-hand-o-right"></i>&nbsp;14<span style="font-size: 5px;">书币</span></span></if>
                                                        <!-- Modal -->
                                                        <div class="modal fade" id="content" tabindex="-1" role="dialog" aria-labelledby="contentLabel">
                                                            <div class="modal-dialog" role="document" style="height: 500px;">
                                                                <div class="modal-content">
                                                                    <div class="modal-header">
                                                                        <span class="title_head" id="" style="font-size: 16px; margin-left: 30px; "></span>
                                                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                                        <h5 class="modal-title_content" id="contentLabel"></h5>
                                                                    </div>
                                                                    <div style="font-size: 14px; line-height: 30px; SCROLLBAR-FACE-COLOR: #666666; Z-INDEX: 1; SCROLLBAR-HIGHLIGHT-COLOR: #CCCCCC; MARGIN-LEFT: 30px; OVERFLOW: auto; WIDTH: 550px; SCROLLBAR-SHADOW-COLOR: #666666; SCROLLBAR-3DLIGHT-COLOR: #666666; SCROLLBAR-ARROW-COLOR: #f3e6a0; SCROLLBAR-DARKSHADOW-COLOR: #444444; HEIGHT: 750px;" id="content_all"></div>
                                                                    <div class="modal-footer">
                                                                        <button type="button" id="prev" data-cpid="" style="" data-id="" onClick="gbzhangjie(1)" class="btn btn-default">上一章</button>
                                                                        <button type="button" id="next" data-cpid="" style="" data-id="" onClick="gbzhangjie(2)" class="btn btn-primary">下一章</button>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </td>
                                                    <td>{$val['novel_name']}</td>
                                                    <td>{$val['add_time']}</td>

                                                    <if condition="($val.novel_id) and ($ismeiti eq 1) and (($p eq '') or ($p eq 1))">
														<td>
															<if condition="$val['order_set'] lt 6">
															<!--<a href="{:U('chapter',array('show'=>$val['novel_id'],'chapter_id'=>$val['id'],'chapter'=>$val['chapter'],'chaptern'=>$val['novel_name']))}" title="文案内容到当前章节,
	原文链接为下一章" class="wenan"><i class="fa fa-link"></i>
															生成推广文案</a>-->
															<a title="原文链接为当前章节" class="createlink"   data-toggle="modal" data-target="#myModal" ><i class="fa fa-link"></i>
                                                                获取推广链接</a></if>
															<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
																<div class="modal-dialog" role="document">
																	<div class="modal-content">
																		<div class="modal-header">
																			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
																			<h5 class="modal-title" id="myModalLabel">生成推广链接</h5>
																		</div>
																		<div class="modal-body">
																			<div><span style="margin-top: 8px; margin-left: 40px;">入口页面</span><span style="margin-top: 8px; margin-left: 40px;">小说阅读页</span></div>
																			<div style="margin-top: 30px; margin-left:20px;"><span style="color:red">*</span>派单链接地址
																				<span style="margin-top: 30px; margin-left:20px;" class="url"></span>
																			</div>
																			<div><img style="width: 80px; margin-left: 150px; margin-top: 40px;" src="{$novel['img']}"/></div>
																			<div style="margin-top: 30px; margin-left: 30px "><span>阅读原文文章</span><span style="margin-left: 50px; font-weight: 700" id="zhangjiename"></span></div>
																		</div>
																	</div>
																</div>
															</div>
														</td>
													</if>
                                                </tr>
                                            </volist>
                                            </tbody>
                                        </table>
                                    </form>
                                </div>
                            </div>
                            {$page}
                            <!-- PAGE CONTENT ENDS -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.page-content -->
            </div>
        </div><!-- /.main-content -->


    </div><!-- /.main-container -->


    <include file="Public/footerjs"/>
    <!-- inline scripts related to this page -->
    <script type="text/javascript">
        $(function () {
            $(".check-all").click(function () {
                $(".aids").prop("checked", this.checked);
            });
            $(".aids").click(function () {
                var option = $(".ids");
                option.each(function (i) {
                    if (!this.checked) {
                        $(".check-all").prop("checked", false);
                        return false;
                    } else {
                        $(".check-all").prop("checked", true);
                    }
                });
            });
            $("#submit").click(function () {
                bootbox.confirm({
                    title: "系统提示",
                    message: "是否要删除所选文章？",
                    callback: function (result) {
                        if (result) {
                            $("#form").submit();
                        }
                    },
                    buttons: {
                        "cancel": {"label": "取消"},
                        "confirm": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
            });
            $(".del").click(function () {
                var url = $(this).attr('val');
                bootbox.confirm({
                    title: "系统提示",
                    message: "是否要该文章？",
                    callback: function (result) {
                        if (result) {
                            window.location.href = url;
                        }
                    },
                    buttons: {
                        "cancel": {"label": "取消"},
                        "confirm": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
            });
            $(".createlink").click(function () {
                //获取的章节id
                var id= $(this).parent().parent().find('td:eq(0)').find('input:eq(0)').prop('value');
                //小说id
                var novel_id= $('.center').find("input:eq(1)").val();
                //登陆的id
                var uid= $('.uid').attr('value');
                var zhangjie = $(this).parent().parent().find('td:eq(1)').text();
                var name = $(this).parent().parent().find('td:eq(2)').find('a').text();
                $(".url").text('http://qikaism.cn/Home/Novel/show/id/'+id+'/novel_id/'+novel_id+/uid/+uid)
                $("#zhangjiename").text(zhangjie+name);
            })
            $(".content_zj").click(function () {
                var order_set =  $(this).attr('id');
                $(".chapter_first").attr('value',order_set);
                if (parseInt($(".chapter_first").attr('value')) ==1){
                    $("#prev").attr('style','display:none');
                }else if(parseInt($(".chapter_first").attr('value')) == parseInt($(".chapter_last").attr('value'))){
                    $("#next").attr('style','display:none');
                }else{
                    $("#prev").attr('style','');
                    $("#next").attr('style','');
                }
                $("#prev").attr('data-id',order_set);
                $("#next").attr('data-id',order_set);
                $.ajax({
                    type:'GET',
                    url:'{:U("chapter")}',
                    data:{
                        "cptid":order_set,
                        "novel_id":$('.content_zj').attr('novel-id')
                    },
                    success:function(data){
                        console.dir(data[0].chapter)
                        //模态框中的章节和标题
                        $('.title_head').text(data[0].chapter+data[0].title);
                        //模态框中的content
                        $("#content_all").html(data[0].content);
                        //模态框id
                        $("title_head").attr('id',index);
                    },
                    dateType:'json'
                });
            })


        })
        function gbzhangjie(v){
            if (v == 1){
                var cpid = parseInt($("#prev").attr('data-id'))-1;
                $("#prev").attr("data-id",cpid);
                $("#next").attr("data-id",cpid);
            }else if(2){
                var cpid = parseInt($("#prev").attr('data-id'))+1;
                $("#prev").attr("data-id",cpid);
                $("#next").attr("data-id",cpid);
            }
            $(".chapter_first").attr('value',cpid);
            if (parseInt($(".chapter_first").attr('value')) ==1){
                $("#prev").attr('style','display:none');
            }else if(parseInt($(".chapter_first").attr('value')) == parseInt($(".chapter_last").attr('value'))){
                $("#next").attr('style','display:none');
            }else{
                $("#prev").attr('style','');
                $("#next").attr('style','');
            }
            $.ajax({
                type:'GET',
                url:'{:U("chapter")}',
                data:{
                    "cpid":cpid,
                    "novel_id":$('.content_zj').attr('novel-id')
                },
                success:function(data){
                    //模态框中的章节和标题
                    $('.title_head').text(data[0].chapter+data[0].title);
                    //模态框中的content
                    $("#content_all").html(data[0].content);
                },
                dateType:'json'
            });
        }
    </script>
</body>
</html>
